package models

import (
	"go-admin/common/models"
)

type Environment struct {
	models.Model

	Name         string  `json:"name" gorm:"type:varchar(128);comment:环境名称"`
	Code         string  `json:"code" gorm:"type:varchar(128);comment:环境标识"`
	CodeBranch   string  `json:"codeBranch" gorm:"type:varchar(128);comment:代码分支"`
	Credential   string  `json:"credential" gorm:"type:varchar(128);comment:gitlab凭证"`
	Namespace    string  `json:"namespace" gorm:"type:varchar(128);comment:命名空间"`
	ClusterId    int     `json:"clusterId" gorm:"type:int;comment:集群id"`
	Cluster      Cluster `json:"cluster"`
	JenkinsId    int     `json:"jenkinsId" gorm:"type:int;comment:jenkins id"`
	Jenkins      Jenkins `json:"jenkins"`
	ImageUrl     string  `json:"imageUrl" gorm:"type:varchar(128);comment:镜像仓库地址"`
	ImageProject string  `json:"imageProject" gorm:"type:varchar(128);comment:镜像仓库项目"`
	Notify       string  `json:"notify" gorm:"type:varchar(128);comment:飞书通知"`
	Remark       string  `json:"remark" gorm:"type:varchar(255);comment:备注"`
	models.ModelTime
	models.ControlBy
}

func (Environment) TableName() string {
	return "environment"
}

func (e *Environment) Generate() models.ActiveRecord {
	o := *e
	return &o
}

func (e *Environment) GetId() interface{} {
	return e.Id
}
